package cn.liuhuan1;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScans;
import org.springframework.web.client.RestTemplate;

/**
 * @Auther: liuhuan
 * @Date: 2021/1/20 - 01 - 20 - 17:09
 * @Description:
 * @version: 1.0
 */
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients(basePackages = "cn.liuhuan1.api")
@ComponentScans(@ComponentScan({"cn.liuhuan1.blogsModel.*"}))  //扫描指定路径下的组件
@MapperScan(basePackages={"cn.liuhuan1.blogsModel.dao.*"})
public class SpringAppStart {

    @Bean  //给容器中添加组件，以方法名作为组件的id，返回类型就是组件类型
    @LoadBalanced
    RestTemplate restTemplate(){
        return new RestTemplate();
    }
    public static void main(String[] args) {
        SpringApplication.run(SpringAppStart.class,args);
    }

}
